package day8;

/**
 * @author oldliu
 * @since 1.0
 */
public class Worker extends Thread{
    public Worker(String n){
        super(n);
    }

    @Override
    public void run() {
        while (true){
            System.out.println("工人 "+getName()+"干了会活");
            System.out.println(getName()+"睡一会");
            try {
                sleep(1500);
                System.out.println(getName()+"睡到自然醒，继续干活");
            } catch (InterruptedException e) {
                e.printStackTrace();
                System.out.println(getName()+"被吵醒，继续干活");
            }
        }
    }
}
